#!/usr/bin/env python
from django.forms.fields import Field, CharField, ChoiceField
from django.forms.widgets import Select, TextInput
from widgets import CascadeChoices

class CascadeChoiceForm2( Field ):
    widget = Select
    def __init__( self, **kwargs ):
        super(CascadeChoiceForm,self).__init__( **kwargs )
        self.choices = [(0,"------"),(1,1),(2,2),(3,3),(4,4),(5,5),]
        
    def _get_choices(self):
        return self._choices
    def _set_choices(self, value):
        self._choices = self.widget.choices = list(value)
    choices = property(_get_choices, _set_choices)

class CascadeChoice( Field ):
    widget = CascadeChoices
